import java.util.Arrays;
import java.util.Comparator;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 18128
 * Date: 2023-09-23
 * Time: 19:41
 */
class stu implements Comparable<stu>
{
    public int age;
    public String name;

    public stu() {
    }

    public stu(int age, String name) {
        this.age = age;
        this.name = name;
    }

    @Override
    public String toString() {
        return "姓名"+name+" "+"年龄"+age;
    }

    @Override
    public int compareTo(stu o) {
        return this.age-o.age;
    }
}
class agebijiao implements Comparator<stu>
{
    @Override
    public int compare(stu o1, stu o2) {
        return o1.age-o2.age;
    }
}
class nianlin implements Comparator<stu>
{
    @Override
    public int compare(stu o1, stu o2) {
        return o1.name.compareTo(o2.name);
    }
}
public class hjx1 {
    public static void main(String[] args) {
        stu s[]=new stu[3];
        s[0]=new stu(10,"hjx");
        s[1]=new stu(13,"zjx");
        s[2]=new stu(12,"wjx");
        agebijiao agg=new agebijiao();
//        Arrays.sort(s,agg);
        nianlin n1=new nianlin();
        Arrays.sort(s,n1);
        System.out.println(Arrays.toString(s));
//        if(s[0].compareTo(s[1])>0)
        if(agg.compare(s[0],s[1])>0)
        {
            System.out.println("s[0].age>s[1].age");
        }
        else
        {
            System.out.println("s[0].age<s[1].age");
        }
    }

}
